﻿using Newtonsoft.Json;
using ThresholdAssistant.DataContract.Extensions;
using System;
using System.Text.Json.Serialization;

namespace ThresholdAssistant.DataContract.Param
{
    /// <summary>
    /// 商户推送请求参数
    /// </summary>
    [Serializable]
    public class MerchantPushParam
    {
        /// <summary>
        /// 推送类型
        /// </summary>
        [JsonProperty("type"), JsonPropertyName("type")]
        public int Type { get; set; }

        /// <summary>
        /// 商户编号
        /// </summary>
        [JsonProperty("merchant_no"), JsonPropertyName("merchant_no")]
        public string MerchantNo { get; set; }

        /// <summary>
        /// 推送时间
        /// </summary>
        [JsonProperty("service_time"), JsonPropertyName("service_time")]
        public DateTime ServiceTime { get; set; } = DateTime.Now.ToCstTime();

        /// <summary>
        /// 业务流水号
        /// </summary>
        [JsonProperty("serial_no"), JsonPropertyName("serial_no")]
        public string SerialNo { get; set; } = DateTime.Now.ToCstTime().ToString("yyyyMMddHHmmssffff");
    }

    /// <summary>
    /// 商户推送请求参数
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable]
    public class MerchantPushParam<T> : MerchantPushParam
    {
        /// <summary>
        /// 推送的数据
        /// </summary>
        [JsonProperty("data"), JsonPropertyName("data")]
        public T Data { get; set; }
    }
}